<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>

<body>
    <div id="app">
        <!-- <input type="text" :value="value1" @input="value1 = $event.target.value"> -->
        <!-- <input type="checkbox" @change="handleChange($event)" :checked="value1"> -->
        <!-- <input type="checkbox" v-model="value1"> -->
        <!-- <div>{{value1}}</div> -->
        <div>
            <input type="text" id="test">
            <div id="test1"></div>
        </div>
    </div>
    <script>
        // var vm = new Vue({
        //         el: '#app',
        //         data: {
        //             value1: false
        //         },
        //         methods: {
        //             handleChange(val) {
        //                 this.value1 = val.target.checked
        //             }
        //         },
        //     })
            var obj = {}
            Object.defineProperty(obj, 'hello', {
                get() {
                    console.log('get被调用了')
                },
                set(val) {
                    document.getElementById('test').value = val
                    document.getElementById('test1').innerHTML = val
                }
            })
            document.getElementById('test').addEventListener('input', (e) => {
                obj.hello = e.target.value
            })
    </script>
</body>

</html>